import pymysql
def chaxun():

    # 建立数据库连接
    conn = pymysql.connect(host="192.168.10.6",user="sunping",password="sunping",database="zhongmian")
    # 创建游标对象
    cursor = conn.cursor()
    # 执行查询语句
    query = "SELECT count(*) FROM mohao_table"

    cursor.execute(query)
    # 获取查询结果
    result = cursor.fetchall()
    # print(result)
    # 关闭游标和数据库连接
    cursor.close()
    conn.close()

    return result
for i in chaxun():
    print(i)